package com.netease.pris.activity;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.preference.Preference;
import com.netease.g.b;
import com.netease.pris.a.f;
import com.netease.pris.a.h;
import java.io.File;

class l extends AsyncTask
{
  public static final int a = 0;
  public static final int b = 1;
  public static final int c = 2;
  public static final int d = 3;
  private Context f;
  private int g;
  private PowerManager.WakeLock h;
  private int i = 1;

  public l(PRISActivitySetting paramPRISActivitySetting, Context paramContext, int paramInt1, int paramInt2)
  {
    this.f = paramContext;
    this.g = paramInt1;
    this.h = ((PowerManager)this.f.getSystemService("power")).newWakeLock(1, "CacheClearTask");
    this.i = paramInt2;
  }

  protected Integer a(Void[] paramArrayOfVoid)
  {
    String str4;
    String str1;
    if (this.i == 1)
    {
      str4 = com.netease.a.a.e.b();
      str1 = com.netease.a.a.e.c();
    }
    for (Object localObject1 = str4; ; localObject1 = null)
    {
      while (true)
      {
        File localFile1;
        try
        {
          this.h.acquire();
          if (this.g != 2)
            break label722;
          l1 = f.e(new File((String)localObject1)) + com.netease.pris.a.e.b();
          com.netease.a.a.e.c(str1);
          com.netease.pris.a.i.f(str1);
          localFile1 = new File((String)localObject1);
          if (!localFile1.exists())
          {
            if (this.i != 1)
              continue;
            com.netease.pris.c.i.a(this.e, null);
            Integer localInteger4 = Integer.valueOf(1);
            localObject3 = localInteger4;
            return localObject3;
            if (this.i != 2)
              break;
            String str3 = com.netease.a.a.e.d();
            str1 = com.netease.a.a.e.e();
            localObject1 = str3;
            continue;
            com.netease.pris.c.i.b(this.e, null);
            continue;
          }
        }
        finally
        {
          if ((this.h == null) || (!this.h.isHeld()))
            continue;
          this.h.release();
          this.h = null;
          com.netease.a.a.e.b((String)localObject1);
          com.netease.a.a.e.b(str1);
        }
        String[] arrayOfString1 = localFile1.list();
        if (arrayOfString1 == null);
        for (int j = 0; ; j = arrayOfString1.length)
        {
          if (j != 0)
            break label326;
          String[] arrayOfString3 = new String[2];
          arrayOfString3[0] = String.valueOf(100);
          arrayOfString3[1] = "0";
          publishProgress(arrayOfString3);
          Integer localInteger3 = Integer.valueOf(3);
          localObject3 = localInteger3;
          if ((this.h != null) && (this.h.isHeld()))
          {
            this.h.release();
            this.h = null;
          }
          com.netease.a.a.e.b((String)localObject1);
          com.netease.a.a.e.b(str1);
          break;
        }
        label326: com.netease.a.a.e.a((String)localObject1);
        PRISActivitySetting.c(this.e).setMax(j);
        long l2 = 0L;
        int k = 0;
        if (k < j)
        {
          File localFile2;
          synchronized (PRISActivitySetting.d(this.e))
          {
            if (PRISActivitySetting.e(this.e))
            {
              b.c("doInBackground", "user cancel！");
              PRISActivitySetting.a(this.e, false);
              localObject3 = Integer.valueOf(0);
              if ((this.h != null) && (this.h.isHeld()))
              {
                this.h.release();
                this.h = null;
              }
              com.netease.a.a.e.b((String)localObject1);
              com.netease.a.a.e.b(str1);
              continue;
            }
            localFile2 = new File((String)localObject1, arrayOfString1[k]);
            boolean bool = localFile2.exists();
            if (!bool)
              k++;
          }
          if (localFile2.isFile())
            l2 += localFile2.length();
          while (true)
          {
            com.netease.a.a.e.a(localFile2);
            String str2 = f.a(this.f, l2);
            String[] arrayOfString2 = new String[2];
            arrayOfString2[0] = String.valueOf(k + 1);
            arrayOfString2[1] = str2;
            publishProgress(arrayOfString2);
            break;
            if (!localFile2.isDirectory())
              continue;
            l2 += f.e(localFile2);
          }
        }
        if (this.i == 1)
          com.netease.pris.c.i.a(this.e, null);
        while (true)
        {
          com.netease.a.a.e.c((String)localObject1);
          if ((this.g != 2) || (l1 > 3145728L))
            break label672;
          Integer localInteger2 = Integer.valueOf(2);
          localObject3 = localInteger2;
          if ((this.h != null) && (this.h.isHeld()))
          {
            this.h.release();
            this.h = null;
          }
          com.netease.a.a.e.b((String)localObject1);
          com.netease.a.a.e.b(str1);
          break;
          com.netease.pris.c.i.b(this.e, null);
        }
        label672: Integer localInteger1 = Integer.valueOf(1);
        Object localObject3 = localInteger1;
        if ((this.h != null) && (this.h.isHeld()))
        {
          this.h.release();
          this.h = null;
        }
        com.netease.a.a.e.b((String)localObject1);
        com.netease.a.a.e.b(str1);
        continue;
        label722: long l1 = 0L;
      }
      str1 = null;
    }
  }

  protected void a(Integer paramInteger)
  {
    if (paramInteger.intValue() == 2)
    {
      h.a(this.f, 2131362045);
      paramInteger = Integer.valueOf(1);
    }
    String str2;
    if (paramInteger.intValue() == 1)
    {
      String str1 = f.a(this.f, 0L);
      PRISActivitySetting localPRISActivitySetting7 = this.e;
      Object[] arrayOfObject3 = new Object[1];
      arrayOfObject3[0] = str1;
      str2 = localPRISActivitySetting7.getString(2131362062, arrayOfObject3);
      if (this.i == 1)
        PRISActivitySetting.a(this.e).setSummary(str2);
    }
    else if (paramInteger.intValue() == 0)
    {
      h.a(this.f, 2131362073);
      if (this.i != 1)
        break label300;
      Preference localPreference2 = PRISActivitySetting.a(this.e);
      PRISActivitySetting localPRISActivitySetting4 = this.e;
      Object[] arrayOfObject2 = new Object[1];
      arrayOfObject2[0] = this.e.getString(2131362070);
      localPreference2.setSummary(localPRISActivitySetting4.getString(2131362062, arrayOfObject2));
      PRISActivitySetting localPRISActivitySetting5 = this.e;
      PRISActivitySetting localPRISActivitySetting6 = this.e;
      Context localContext2 = this.f;
      String[] arrayOfString2 = new String[2];
      arrayOfString2[0] = com.netease.a.a.e.b();
      arrayOfString2[1] = com.netease.a.a.e.c();
      PRISActivitySetting.a(localPRISActivitySetting5, new en(localPRISActivitySetting6, localContext2, 1, arrayOfString2));
      PRISActivitySetting.f(this.e).execute(new Void[0]);
    }
    while (true)
    {
      if (paramInteger.intValue() == 3);
      this.f = null;
      if (PRISActivitySetting.c(this.e) != null)
      {
        PRISActivitySetting.c(this.e).dismiss();
        PRISActivitySetting.a(this.e, null);
      }
      return;
      if (this.i != 2)
        break;
      PRISActivitySetting.b(this.e).setSummary(str2);
      break;
      label300: if (this.i != 2)
        continue;
      Preference localPreference1 = PRISActivitySetting.b(this.e);
      PRISActivitySetting localPRISActivitySetting1 = this.e;
      Object[] arrayOfObject1 = new Object[1];
      arrayOfObject1[0] = this.e.getString(2131362070);
      localPreference1.setSummary(localPRISActivitySetting1.getString(2131362062, arrayOfObject1));
      PRISActivitySetting localPRISActivitySetting2 = this.e;
      PRISActivitySetting localPRISActivitySetting3 = this.e;
      Context localContext1 = this.f;
      String[] arrayOfString1 = new String[2];
      arrayOfString1[0] = com.netease.a.a.e.d();
      arrayOfString1[1] = com.netease.a.a.e.e();
      PRISActivitySetting.b(localPRISActivitySetting2, new en(localPRISActivitySetting3, localContext1, 2, arrayOfString1));
      PRISActivitySetting.g(this.e).execute(new Void[0]);
    }
  }

  protected void a(String[] paramArrayOfString)
  {
    super.onProgressUpdate(paramArrayOfString);
    int j = Integer.valueOf(paramArrayOfString[0]).intValue();
    PRISActivitySetting.c(this.e).setProgress(j);
    ProgressDialog localProgressDialog = PRISActivitySetting.c(this.e);
    PRISActivitySetting localPRISActivitySetting = this.e;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = paramArrayOfString[1];
    localProgressDialog.setMessage(localPRISActivitySetting.getString(2131362071, arrayOfObject));
  }

  protected void onPreExecute()
  {
    PRISActivitySetting.a(this.e, new ProgressDialog(this.f));
    PRISActivitySetting.c(this.e).setMax(100);
    PRISActivitySetting.c(this.e).setProgressStyle(1);
    ProgressDialog localProgressDialog = PRISActivitySetting.c(this.e);
    PRISActivitySetting localPRISActivitySetting = this.e;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = this.e.getString(2131362072);
    localProgressDialog.setMessage(localPRISActivitySetting.getString(2131362071, arrayOfObject));
    PRISActivitySetting.c(this.e).setCancelable(false);
    PRISActivitySetting.c(this.e).setButton(-2, this.e.getString(2131362053), new ea(this));
    PRISActivitySetting.c(this.e).show();
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.l
 * JD-Core Version:    0.6.0
 */